'\" te
.\"  Copyright 1989 AT&T  Copyright (c) 2001, Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH USTAT 2 "Jul 23, 2001"
.SH NAME
ustat \- get file system statistics
.SH SYNOPSIS
.LP
.nf
#include <sys/types.h>
#include <ustat.h>

\fBint\fR \fBustat\fR(\fBdev_t\fR \fIdev\fR, \fBstruct ustat *\fR\fIbuf\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBustat()\fR function returns information about a mounted file system.
The \fIdev\fR argument is a device number identifying a device containing a
mounted file system (see \fBmakedev\fR(3C)). The \fIbuf\fR argument is a
pointer to a \fBustat\fR structure that includes the following members:
.sp
.in +2
.nf
daddr_t  f_tfree;      /* Total free blocks */
ino_t    f_tinode;     /* Number of free inodes */
char     f_fname[6];   /* Filsys name */
char     f_fpack[6];   /* Filsys pack name */
.fi
.in -2

.sp
.LP
The \fBf_fname\fR and \fBf_fpack\fR members may not contain significant
information on all systems; in this case, these members will contain the null
character as the first character.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fB0\fR is returned. Otherwise,  \fB\(mi1\fR is
returned and \fBerrno\fR is set to indicate the error.
.SH ERRORS
.sp
.LP
The \fBustat()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBECOMM\fR\fR
.ad
.RS 13n
The \fIdev\fR argument is on a remote machine and the link to that machine is
no longer active.
.RE

.sp
.ne 2
.na
\fB\fBEFAULT\fR\fR
.ad
.RS 13n
The \fIbuf\fR argument points to an illegal address.
.RE

.sp
.ne 2
.na
\fB\fBEINTR\fR\fR
.ad
.RS 13n
A signal was caught during the execution of the \fBustat()\fR function.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 13n
The \fIdev\fR argument is not the device number of a device containing a
mounted file system.
.RE

.sp
.ne 2
.na
\fB\fBENOLINK\fR\fR
.ad
.RS 13n
The \fIdev\fR argument refers to a device on a remote machine and the link  to
that machine is no longer active.
.RE

.sp
.ne 2
.na
\fB\fBEOVERFLOW\fR\fR
.ad
.RS 13n
One of the values returned cannot be represented in the structure pointed to by
\fIbuf\fR.
.RE

.SH USAGE
.sp
.LP
The \fBstatvfs\fR(2) function should be used in favor of \fBustat()\fR.
.SH SEE ALSO
.sp
.LP
.BR stat (2),
.BR statvfs (2),
.BR makedev (3C),
.BR lfcompile (7)
.SH BUGS
.sp
.LP
The \fBNFS\fR revision 2 protocol does not permit the number of free files to
be provided to the client; therefore, when \fBustat()\fR has completed on an
\fBNFS\fR file system, \fBf_tinode\fR is always \fB\(mi1\fR\&.
